export default {
	// 获取页面数据
	getTableData() {
		var params = {
			language: this.$store.getters.getLanguage,
		}

		this.axiosPost("Development/developmentShow", params, function(res) {
			// console.log(res);
			if(res.data.code === 0) {
				this.tableData = res.data.data
				
				this.tableData.dev_0.value = JSON.parse(this.tableData.dev_0.value);
				this.tableData.dev_1.value = JSON.parse(this.tableData.dev_1.value);
				this.tableData.dev_2.value = JSON.parse(this.tableData.dev_2.value);
				this.tableData.dev_3.value = JSON.parse(this.tableData.dev_3.value);
				this.tableData.dev_4.value = JSON.parse(this.tableData.dev_4.value);
				this.tableData.dev_5.value = JSON.parse(this.tableData.dev_5.value);
				this.tableData.dev_6.value = JSON.parse(this.tableData.dev_6.value);
				this.tableData.dev_7.value = JSON.parse(this.tableData.dev_7.value);
				this.tableData.dev_8.value = JSON.parse(this.tableData.dev_8.value);
				this.tableData.dev_9.value = JSON.parse(this.tableData.dev_9.value);
				this.tableData.dev_10.value = JSON.parse(this.tableData.dev_10.value);
				this.tableData.dev_11.value = JSON.parse(this.tableData.dev_11.value);
				this.tableData.dev_12.value = JSON.parse(this.tableData.dev_12.value);
				this.tableData.dev_13.value = JSON.parse(this.tableData.dev_13.value);
				this.tableData.dev_14.value = JSON.parse(this.tableData.dev_14.value);
				this.tableData.dev_15.value = JSON.parse(this.tableData.dev_15.value);
				this.tableData.dev_16.value = JSON.parse(this.tableData.dev_16.value);
				this.tableData.dev_17.value = JSON.parse(this.tableData.dev_17.value);
				this.tableData.dev_18.value = JSON.parse(this.tableData.dev_18.value);
				this.tableData.dev_19.value = JSON.parse(this.tableData.dev_19.value);
				// this.msgSuccess(res.data.message)
			} else  {
				this.msgError(res.data.message)
			}
			//分页
			// this.total = res.data.data.total
			// console.log(this.total);
		})
	},
	
	//新增text
	addText(){
		this.form.text.push('');
	},
	//删除text
	delText(){
		if(this.form.text.length >1) {
			this.form.text.splice(this.form.text.length-1 , 1)
		}
	},


	//编辑
	edit(val) {
		this.$refs.Edit.key = val;
		this.$refs.Edit.form = this.tableData[val].value;
		this.$refs.Edit.upImg.imageUrl = this.tableData[val].value.img_url;
		this.$refs.Edit.upImg1.imageUrl = this.tableData[val].value.img_url1;
		this.$refs.Edit.isShow = true;
	},
	
	editContent(val,c) {
		this.key1 = val;
		this.c = c;
		this.form = this.tableData[val].value;
		this.isShow1 = true;
	},
	
	submit(){
		let params = {
			key : this.key1,
			value : JSON.stringify(this.form),
			language:this.$store.getters.getLanguage
		}
		console.log(params);
		this.axiosPost('Development/development', params , res => {
			if(res.data.code === 0) {
				this.msgSuccess(res.data.message);
				this.getTableData();
				this.isShow1 = false;
			}else {
				this.msgError(res.data.message)
			}
		})
	},
	
	
	
	
	closeDialog(){
		this.c = '',
		this.key1 = '',//key
		this.form = {//form
			title:'',
			text:[''],
			content:''
		}
		this.isShow1 = false;
	},

	
}
